home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6780 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  997 b 

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Tradition or what?
  5. Date: 14 Feb 1996 18:43:32 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4fu6kkINNmea@keats.ugrad.cs.ubc.ca>
  8. References: <1996Feb13.115611.73989@cc.usu.edu>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <1996Feb13.115611.73989@cc.usu.edu>,
  12. Erik van Renselaar <erik@cc.usu.edu> wrote:
  13.  >Hi all,
  14.  >
  15.  >Can anyone tell me what the use is of returning
  16.  >the same value for the function and one of the
  17.  >output parameters, like it is done in strcpy?
  18.  >Why return a string for the function if the 
  19.  >result is in its first parameter as well?
  20.  >
  21.  >Is this just tradition or is it actually useful
  22.  >for anything?
  23.  
  24. Of course it is useful. It establishes the function as an expression, an
  25. rvalue. Thus you can nest it, and do something like>
  26.  
  27.     if (!strcmp(strcpy(s1,s2),s3)) {
  28.         /* ... */
  29.     }
  30.  
  31.  
  32.  >Erik
  33.  
  34.  
  35. -- 
  36.  
  37.